package cn.jhc.bean;

import java.util.HashSet;

import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

@Entity
@Table(name="class")
public class Clazz {
	private Integer no;
	private String name;
	private String specialty;
	private String college;
	
	
	
	private Set<Student> students = new HashSet<Student>();
	private Set<Study> studys = new HashSet<Study>();
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="CLASSNO")
	public Integer getNo() {
		return no;
	}
	
	public void setNo(Integer no) {
		this.no = no;
	}
	
	@Column(name="CLASSNAME",columnDefinition="varchar(255)")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	@Column(name="SPECIALTY",columnDefinition="varchar(255)")
	public String getSpecialty() {
		return specialty;
	}

	public void setSpecialty(String specialty) {
		this.specialty = specialty;
	}
	@Column(name="COLLEGE",columnDefinition="varchar(255)")
	public String getCollege() {
		return college;
	}

	public void setCollege(String college) {
		this.college = college;
	}

	@OneToMany(mappedBy="clazz")
	@Cascade (org.hibernate.annotations.CascadeType.SAVE_UPDATE)
	public Set<Student> getStudents() {
		return students;
	}

	public void setStudents(Set<Student> students) {
		this.students = students;
	}
	@OneToMany(mappedBy="clazz")
	@Cascade (org.hibernate.annotations.CascadeType.SAVE_UPDATE)
	public Set<Study> getStudys() {
		return studys;
	}

	public void setStudys(Set<Study> studys) {
		this.studys = studys;
	}
	
	
}
